<template>
  <div class="wholesoldContent">
    <div class="wholesoldTitle">
      <!-- <div class="customerTitle">海川医药整件下架{{ systemTime }}日报</div> -->
      <div class="customerTitle">海川医药整件下架{{ dateTransfer }}日报</div>
      <!-- <div class="searchBtn">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="date"
        ></el-date-picker>
        <el-button type="success" @click="handlesoldsearch">搜索</el-button>
      </div> -->
    </div>
    <div class="soldtable">
      <div class="customtr1">
        <div class="customText">货主</div>
        <div class="delivery">
          <div class="deliveryTop">补货</div>
          <div class="deliveryBottom">
            <span>AGV</span>
            <span>立库</span>
            <span>平库</span>
            <span>总件数</span>
          </div>
        </div>
        <div class="deliveryright">
          <div class="deliveryTop">出库</div>
          <div class="deliveryBottomright">
            <span>AGV</span>
            <span>立库</span>
            <span>平库</span>
            <span>医院</span>
            <span>总件数</span>
          </div>
        </div>
        <!-- <div class="customText">补货总件数</div>
      <div class="customText">平库补货件数</div>
      <div class="customText">立库补货件数</div>
      <div class="customText">AGV补货件数</div> -->
        <!-- <div class="customText">平库件数</div>
      <div class="customText">医院件数</div>
      <div class="customText">AGV件数</div>
      <div class="customText">立库件数</div> -->
        <!-- <div class="completeText">出库总件数</div> -->
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西海通</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateAgvbhjsTotal"
              v-model="soldform.htAgv"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              v-model="soldform.htLkbhjs"
              @input="calculatelkbhjsTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkbhjsTotal"
            v-model="soldform.htPkbhjs"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatebhzjsTotal"
              v-model="soldform.htBhzjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateAgvjsTotal"
              v-model="soldform.htAgvjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatelkjsTotal"
              v-model="soldform.htLkjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatepkjsTotal"
              v-model="soldform.htPkjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateyyTotal"
              v-model="soldform.htYyjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-input
              @input="calculateckzjsTotal"
              v-model="soldform.htCkzjs"
              size="medium"
            />
          </div>
        </div>
      </div>
      <div class="customtr2">
        <div class="customText wyLayout">陕西伟业</div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateAgvbhjsTotal"
              v-model="soldform.wyAgv"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              v-model="soldform.wyLkbhjs"
              @input="calculatelkbhjsTotal"
              size="medium"
            />
          </div>
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkbhjsTotal"
            v-model="soldform.wyPkbhjs"
            size="medium"
          />
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatebhzjsTotal"
              v-model="soldform.wyBhzjs"
              size="medium"
            />
          </div>
        </div>

        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateAgvjsTotal"
              v-model="soldform.wyAgvjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatelkjsTotal"
              v-model="soldform.wyLkjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculatepkjsTotal"
              v-model="soldform.wyPkjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop">
            <el-input
              @input="calculateyyTotal"
              v-model="soldform.wyYyjs"
              size="medium"
            />
          </div>
        </div>
        <div class="delivery">
          <div class="deliveryTop noborder">
            <el-input
              @input="calculateckzjsTotal"
              v-model="soldform.wyCkzjs"
              size="medium"
            />
          </div>
        </div>
      </div>
      <!-- <div class="customtr3">
        <div class="customText wyLayout">陕西大洋</div>
        <div class="customText">
          <el-input
            @input="calculateAgvbhjsTotal"
            v-model="soldform.dyAgv"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            v-model="soldform.dyLkbhjs"
            @input="calculatelkbhjsTotal"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkbhjsTotal"
            v-model="soldform.dyPkbhjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatebhzjsTotal"
            v-model="soldform.dyBhzjs"
            size="medium"
          />
        </div>

        <div class="customText">
          <el-input
            @input="calculateAgvjsTotal"
            v-model="soldform.dyAgvjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatelkjsTotal"
            v-model="soldform.dyLkjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkjsTotal"
            v-model="soldform.dyPkjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculateyyTotal"
            v-model="soldform.dyYyjs"
            size="medium"
          />
        </div>
        <div class="completeText">
          <el-input
            @input="calculateckzjsTotal"
            v-model="soldform.dyCkzjs"
            size="medium"
          />
        </div>
      </div> -->
      <div class="customtr3">
        <div class="customText wyLayout">其他货主</div>
        <div class="customText">
          <el-input
            @input="calculateAgvbhjsTotal"
            v-model="soldform.qtAgv"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            v-model="soldform.qtLkbhjs"
            @input="calculatelkbhjsTotal"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkbhjsTotal"
            v-model="soldform.qtPkbhjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatebhzjsTotal"
            v-model="soldform.qtBhzjs"
            size="medium"
          />
        </div>

        <div class="customText">
          <el-input
            @input="calculateAgvjsTotal"
            v-model="soldform.qtAgvjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatelkjsTotal"
            v-model="soldform.qtLkjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculatepkjsTotal"
            v-model="soldform.qtPkjs"
            size="medium"
          />
        </div>
        <div class="customText">
          <el-input
            @input="calculateyyTotal"
            v-model="soldform.qtYyjs"
            size="medium"
          />
        </div>
        <div class="completeText">
          <el-input
            @input="calculateckzjsTotal"
            v-model="soldform.qtCkzjs"
            size="medium"
          />
        </div>
      </div>
      <div class="customtr4">
        <div class="customText wyLayout">合计</div>
        <div class="customText">
          <el-input disabled v-model="AgvbhjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="lkbhjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="pkbhjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="bhzjsTotal" size="medium" />
        </div>

        <div class="customText">
          <el-input disabled v-model="agvjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="lkjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="pkjsTotal" size="medium" />
        </div>
        <div class="customText">
          <el-input disabled v-model="yyjsTotal" size="medium" />
        </div>
        <div class="completeText">
          <el-input disabled v-model="ckzjsTotal" size="medium" />
        </div>
        <!-- <div class="completeText">
        <el-input disabled v-model="jdqTotal" size="medium" />
      </div> -->
      </div>
    </div>
  </div>
</template>

<script>
import { dailyscreenlistsold } from "@/api/system/daily";
export default {
  props:{
    dateTransfer:{
      type:String,
    }
  },
  data() {
    return {
      dateRange: new Date().toISOString().split("T")[0],
      // 陕西海通零货条目数
      ids: null,
      systemTime: "",
      bhzjsTotal: undefined,
      pkbhjsTotal: undefined,
      lkbhjsTotal: undefined,
      AgvbhjsTotal: undefined,
      pkjsTotal: undefined,
      yyjsTotal: undefined,
      agvjsTotal: undefined,
      lkjsTotal: undefined,
      ckzjsTotal: undefined,
      // 伟业
      soldform: {
        rbSj: new Date().toISOString().split("T")[0],
        // 海通
        htBhzjs: null,
        htPkbhjs: null,
        htLkbhjs: null,
        htAgv: null,
        htPkjs: null,
        htYyjs: null,
        htAgvjs: null,
        htLkjs: null,
        htCkzjs: null,
        // 伟业
        wyBhzjs: null,
        wyPkbhjs: null,
        wyLkbhjs: null,
        wyAgv: null,
        wyPkjs: null,
        wyYyjs: null,
        wyAgvjs: null,
        wyLkjs: null,
        wyCkzjs: null,
        // 大洋
        // dyBhzjs: null,
        // dyPkbhjs: null,
        // dyLkbhjs: null,
        // dyAgv: null,
        // dyPkjs: null,
        // dyYyjs: null,
        // dyAgvjs: null,
        // dyLkjs: null,
        // dyCkzjs: null,
        // 其他
        qtBhzjs: null,
        qtPkbhjs: null,
        qtLkbhjs: null,
        qtAgv: null,
        qtPkjs: null,
        qtYyjs: null,
        qtAgvjs: null,
        qtLkjs: null,
        qtCkzjs: null,
      },
    };
  },
  mounted() {
    // 创建一个 Date 对象
    const currentDate = new Date();
    // 获取当前年份
    const year = currentDate.getFullYear();
    // 获取当前月份（注意：月份是从 0 开始计数的，所以需要加 1）
    const month = currentDate.getMonth() + 1;
    // 获取当前日期
    const day = currentDate.getDate();
    // 打印年月日
    this.systemTime = `${year}年${month}月${day}日`;
  },
  beforeDestroy() {},
  methods: {
    handlesoldsearch() {
      dailyscreenlistsold({ rbSj: this.dateTransfer }).then((res) => {
        if (res.data) {
          this.soldform = res.data;
          this.bhzjsTotal =
            Number(this.soldform.htBhzjs) +
            Number(this.soldform.wyBhzjs) +
            Number(this.soldform.qtBhzjs);
          this.pkbhjsTotal =
            Number(this.soldform.htPkbhjs) +
            Number(this.soldform.wyPkbhjs) +
            Number(this.soldform.qtPkbhjs);
          this.lkbhjsTotal =
            Number(this.soldform.htLkbhjs) +
            Number(this.soldform.wyLkbhjs) +
            Number(this.soldform.qtLkbhjs);
          this.AgvbhjsTotal =
            Number(this.soldform.htAgv) +
            Number(this.soldform.wyAgv) +
            Number(this.soldform.qtAgv);
          this.pkjsTotal =
            Number(this.soldform.htPkjs) +
            Number(this.soldform.wyPkjs) +
            Number(this.soldform.qtPkjs);
          this.yyjsTotal =
            Number(this.soldform.htYyjs) +
            Number(this.soldform.wyYyjs) +
            Number(this.soldform.qtYyjs);
          this.agvjsTotal =
            Number(this.soldform.htAgvjs) +
            Number(this.soldform.wyAgvjs) +
            Number(this.soldform.qtAgvjs);
          this.lkjsTotal =
            Number(this.soldform.htLkjs) +
            Number(this.soldform.wyLkjs) +
            Number(this.soldform.qtLkjs);
          this.ckzjsTotal =
            Number(this.soldform.htCkzjs) +
            Number(this.soldform.wyCkzjs) +
            Number(this.soldform.qtCkzjs);
        }
      });
    },
    calculatebhzjsTotal() {
      this.bhzjsTotal =
        Number(this.soldform.htBhzjs) +
        Number(this.soldform.wyBhzjs) +
        Number(this.soldform.qtBhzjs);
    },
    calculatepkbhjsTotal() {
      this.pkbhjsTotal =
        Number(this.soldform.htPkbhjs) +
        Number(this.soldform.wyPkbhjs) +
        Number(this.soldform.qtPkbhjs);
    },
    calculatelkbhjsTotal() {
      this.lkbhjsTotal =
        Number(this.soldform.htLkbhjs) +
        Number(this.soldform.wyLkbhjs) +
        Number(this.soldform.qtLkbhjs);
    },
    calculateAgvbhjsTotal() {
      this.AgvbhjsTotal =
        Number(this.soldform.htAgv) +
        Number(this.soldform.wyAgv) +
        Number(this.soldform.qtAgv);
    },
    calculatepkjsTotal() {
      this.pkjsTotal =
        Number(this.soldform.htPkjs) +
        Number(this.soldform.wyPkjs) +
        Number(this.soldform.qtPkjs);
    },
    calculateyyTotal() {
      this.yyjsTotal =
        Number(this.soldform.htYyjs) +
        Number(this.soldform.wyYyjs) +
        Number(this.soldform.qtYyjs);
    },
    calculateAgvjsTotal() {
      this.agvjsTotal =
        Number(this.soldform.htAgvjs) +
        Number(this.soldform.wyAgvjs) +
        Number(this.soldform.qtAgvjs);
    },
    calculatelkjsTotal() {
      this.lkjsTotal =
        Number(this.soldform.htLkjs) +
        Number(this.soldform.wyLkjs) +
        Number(this.soldform.qtLkjs);
    },
    calculateckzjsTotal() {
      this.ckzjsTotal =
        Number(this.soldform.htCkzjs) +
        Number(this.soldform.wyCkzjs) +
        Number(this.soldform.qtCkzjs);
    },
  },
};
</script>

<style lang="scss" scoped>
.wholesoldContent {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
    background-color: transparent;
  }
  ::v-deep .el-date-editor.el-input,
  .el-date-editor.el-input__inner {
    width: 100%;
  }

  .wholesoldTitle {
    width: 100%;
    text-align: center;
    .customerTitle {
      width: 100%;
      font-size: 30px;
      font-weight: 700;
      margin: 10px 0 20px 0;
    }
    ::v-deep .el-button--success {
      height: 36px;
      margin-left: 30px;
    }
  }
  .soldtable {
    width: 80%;
    margin-top: 20px;
    ::v-deep .el-input__inner {
      height: 65px;
      line-height: 65px;
      border: none;
      text-align: center;
      color: #000000;
      width: 100%;
    }
  }
  .customtr1 {
    width: 100%;
    height: 140px;
    border: 1px solid #e7dfdf;
    background: #05a5ff;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    justify-content: space-around;
    .customText {
      width: 10%;
      height: 140px;
      line-height: 140px;
      text-align: center;
      border-right: 1px solid #e7dfdf;
    }
    .completeText {
      width: 10%;
      height: 140px;
      line-height: 140px;
      text-align: center;
    }
    .delivery {
      width: 40%;
      display: flex;
      flex-direction: column;
      //   border-right: 1px solid #181616;
      .deliveryTop {
        height: 50%;
        line-height: 70px;
        border-right: 1px solid #e7dfdf;
      }
      .noborder {
        border-right: none !important;
      }
      .deliveryBottom {
        height: 50%;
        display: flex;
        line-height: 70px;
        justify-content: space-around;
        border-top: 1px solid #e7dfdf;
        border-right: 1px solid #e7dfdf;
        span {
          width: 25%;
          border-right: 1px solid #e7dfdf;
        }
      }
    }
    .deliveryright {
      width: 50%;
      display: flex;
      flex-direction: column;
      //   border-right: 1px solid #181616;
      .deliveryTop {
        height: 50%;
        line-height: 70px;
        border-right: 1px solid #e7dfdf;
      }
      .noborder {
        border-right: none !important;
      }
      .deliveryBottomright {
        height: 50%;
        display: flex;
        line-height: 70px;
        justify-content: space-around;
        border-top: 1px solid #e7dfdf;
        border-right: 1px solid #e7dfdf;
        span {
          width: 20%;
          border-right: 1px solid #e7dfdf;
        }
      }
    }
  }
  .customtr2 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 10%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .delivery {
      width: 10%;
      display: flex;
      flex-direction: column;
      //   border-right: 1px solid #181616;
      .deliveryTop {
        height: 100%;
        line-height: 70px;
        border-right: 1px solid #181616;
      }
      .noborder {
        border-right: none !important;
      }
      // .deliveryBottom {
      //   height: 50%;
      //   display: flex;
      //   line-height: 70px;
      //   justify-content: space-around;
      //   border-top: 1px solid #181616;
      //   border-right: 1px solid #181616;
      // }
    }
  }
  .customtr3 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 10%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .totalText {
      width: 20%;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      width: 10%;
      height: 70px;
      line-height: 70px;
      text-align: center;
    }
  }
  .customtr4 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    background: #75d561;
    display: flex;
    justify-content: space-around;
    ::v-deep .el-input.is-disabled .el-input__inner {
      background: #75d561;
      font-weight: 700;
      color: #ff4800;
      font-size: 18px;
    }
    .customText {
      width: 10%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    // .totalText {
    //   width: 11.1%;
    // }
    .bhxsbg {
      background: #f5f7fa;
      border-bottom: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      background: #75d561;
      width: 10%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-bottom: 1px solid #181616;
    }
  }
}
</style>